﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using NUnit.Framework;
using NHibernateSample.Domain.Entities;

namespace NHibernateSample.DAL.Test
{
    [TestFixture]
    public class ViewTestFixture
    {
        private NHibernateHelper _helper;
        private ViewTest _viewTest;
        //private int newIdentity = -1;

        [TestFixtureSetUp]
        public void TestFixtureSetup()
        {
            _helper = new NHibernateHelper();
            HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();
        }

        [SetUp]
        public void Setup()
        {
            _viewTest = new ViewTest(_helper.GetSession());
        }

        /// <summary>
        /// 查询出订单时间在2008年10月1日之后的顾客列表，断言其订单时间是否大于2008年10月1日
        /// </summary>
        [Test]
        public void GetCustomerViewTest()
        {
            DateTime testorderDate = new DateTime(2008, 10, 1);
            IList<CustomerView> customers =
                _viewTest.GetCustomerView(testorderDate);
            foreach (CustomerView view in customers)
            {
                Assert.GreaterOrEqual(view.OrderDate, testorderDate);
            }
        }
       

    }
}
